Imports DocumentFormat.OpenXml.Spreadsheet
Imports FineUI
Imports Kimmo
Imports Microsoft.VisualBasic.CompilerServices
Imports System.Collections
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Data.SqlServerCe
Imports System.Diagnostics
Imports System.Runtime.CompilerServices

''' <summary>
''' This is the beginning of the Project_LifeCycle business object to handle interaction between the user interface and the database.
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Class clsProjectLifeCycle
    Public Property ID As String = ""
    Public Property ProjectID As Integer = 0
    Public Property StageID As Integer = 0
    Public Property StageName As String = ""
    Public Property StartDate As Nullable (of Date) = Nothing
    Public Property EndDate As Nullable (of Date) = Nothing
    Public Property Milestones As String = ""
    Public Property IsNew As Boolean = False
    Public Property DateFields As String = "StartDate,EndDate"
    Public Property FieldsToUpdate As String = "ID,ProjectID,StageID,StageName,StartDate,EndDate,Milestones"

''' <summary>
''' The new method of the class to create new Project_LifeCycle records.
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Sub New()
    MyBase.New()
    Clear()
    IsNew = True
    DateFields = "StartDate,EndDate"
    FieldsToUpdate = "ID,ProjectID,StageID,StageName,StartDate,EndDate,Milestones"
End Sub

''' <summary>
''' The Clear method clears all properties of the business object to defaults.
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Sub Clear()
    ID = ""
    ProjectID = 0
    StageID = 0
    StageName = ""
    StartDate = Nothing
    EndDate = Nothing
    Milestones = ""
End Sub

''' <summary>
''' Delete Project_LifeCycle records specified by a list of ID.
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
    Public Shared Sub Delete(ByRef Records As List(Of String))
        For Each rsStr As String In Records
            SQLCompact.RunQuery("delete from [Project_LifeCycle] where ID = " & rsStr, True)
        Next
    End Sub


''' <summary>
''' Delete Project_LifeCycle records meeting a particular field name criteria. In this case, ID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Sub DeleteByID(ByVal strID As String)
    SQLCompact.RunQuery("Delete from [Project_LifeCycle] where [ID] = '" & strID & "'")
End Sub

''' <summary>
''' Delete Project_LifeCycle records from a list of particular field. In this case, ID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Sub DeleteByListOfID(ByRef Records As List(Of String))
        For Each strID As String In Records
    SQLCompact.RunQuery("Delete from [Project_LifeCycle] where [ID] = '" & strID & "'")
        Next
End Sub

''' <summary>
''' Delete Project_LifeCycle records meeting a particular field name criteria. In this case, ProjectID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Sub DeleteByProjectID(ByVal intProjectID As Integer)
    SQLCompact.RunQuery("Delete from [Project_LifeCycle] where [ProjectID] = " & intProjectID)
End Sub

''' <summary>
''' Delete Project_LifeCycle records from a list of particular field. In this case, ProjectID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Sub DeleteByListOfProjectID(ByRef Records As List(Of String))
        For Each intProjectID As String In Records
    SQLCompact.RunQuery("Delete from [Project_LifeCycle] where [ProjectID] = " & intProjectID)
        Next
End Sub

''' <summary>
''' Delete Project_LifeCycle records meeting a particular field name criteria. In this case, StageID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Sub DeleteByStageID(ByVal intStageID As Integer)
    SQLCompact.RunQuery("Delete from [Project_LifeCycle] where [StageID] = " & intStageID)
End Sub

''' <summary>
''' Delete Project_LifeCycle records from a list of particular field. In this case, StageID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Sub DeleteByListOfStageID(ByRef Records As List(Of String))
        For Each intStageID As String In Records
    SQLCompact.RunQuery("Delete from [Project_LifeCycle] where [StageID] = " & intStageID)
        Next
End Sub

''' <summary>
''' Delete Project_LifeCycle records meeting a particular field name criteria. In this case, StageName
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Sub DeleteByStageName(ByVal strStageName As String)
    SQLCompact.RunQuery("Delete from [Project_LifeCycle] where [StageName] = '" & strStageName & "'")
End Sub

''' <summary>
''' Delete Project_LifeCycle records from a list of particular field. In this case, StageName
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Sub DeleteByListOfStageName(ByRef Records As List(Of String))
        For Each strStageName As String In Records
    SQLCompact.RunQuery("Delete from [Project_LifeCycle] where [StageName] = '" & strStageName & "'")
        Next
End Sub

''' <summary>
''' Delete Project_LifeCycle records meeting a particular field name criteria. In this case, StartDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Sub DeleteByStartDate(ByVal datStartDate As Nullable (of Date))
    SQLCompact.RunQuery("Delete from [Project_LifeCycle] where [StartDate] = " & datStartDate)
End Sub

''' <summary>
''' Delete Project_LifeCycle records from a list of particular field. In this case, StartDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Sub DeleteByListOfStartDate(ByRef Records As List(Of String))
        For Each datStartDate As String In Records
    SQLCompact.RunQuery("Delete from [Project_LifeCycle] where [StartDate] = " & datStartDate)
        Next
End Sub

''' <summary>
''' Delete Project_LifeCycle records meeting a particular field name criteria. In this case, EndDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Sub DeleteByEndDate(ByVal datEndDate As Nullable (of Date))
    SQLCompact.RunQuery("Delete from [Project_LifeCycle] where [EndDate] = " & datEndDate)
End Sub

''' <summary>
''' Delete Project_LifeCycle records from a list of particular field. In this case, EndDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Sub DeleteByListOfEndDate(ByRef Records As List(Of String))
        For Each datEndDate As String In Records
    SQLCompact.RunQuery("Delete from [Project_LifeCycle] where [EndDate] = " & datEndDate)
        Next
End Sub

''' <summary>
''' Delete Project_LifeCycle records meeting a particular field name criteria. In this case, Milestones
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Sub DeleteByMilestones(ByVal strMilestones As String)
    SQLCompact.RunQuery("Delete from [Project_LifeCycle] where [Milestones] = '" & strMilestones & "'")
End Sub

''' <summary>
''' Delete Project_LifeCycle records from a list of particular field. In this case, Milestones
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Sub DeleteByListOfMilestones(ByRef Records As List(Of String))
        For Each strMilestones As String In Records
    SQLCompact.RunQuery("Delete from [Project_LifeCycle] where [Milestones] = '" & strMilestones & "'")
        Next
End Sub

''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.ID based on Project_LifeCycle.ID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function IDByID(ByVal strID As String) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "ID", strID, "ID", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.ID based on Project_LifeCycle.ProjectID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function IDByProjectID(ByVal intProjectID As Integer) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "ProjectID", intProjectID, "ID", ";", "Integer")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.ProjectID based on Project_LifeCycle.ID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function ProjectIDByID(ByVal strID As String) As Integer
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "ID", strID, "ProjectID", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return Val(mv)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.ID based on Project_LifeCycle.StageID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function IDByStageID(ByVal intStageID As Integer) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StageID", intStageID, "ID", ";", "Integer")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StageID based on Project_LifeCycle.ID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StageIDByID(ByVal strID As String) As Integer
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "ID", strID, "StageID", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return Val(mv)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.ID based on Project_LifeCycle.StageName
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function IDByStageName(ByVal strStageName As String) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StageName", strStageName, "ID", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StageName based on Project_LifeCycle.ID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StageNameByID(ByVal strID As String) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "ID", strID, "StageName", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.ID based on Project_LifeCycle.StartDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function IDByStartDate(ByVal datStartDate As Nullable (of Date)) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StartDate", datStartDate, "ID", ";", "Nullable (of Date)")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StartDate based on Project_LifeCycle.ID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StartDateByID(ByVal strID As String) As Nullable (of Date)
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "ID", strID, "StartDate", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return IIf((IsDate(mv) = True), CDate(mv), Nothing)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.ID based on Project_LifeCycle.EndDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function IDByEndDate(ByVal datEndDate As Nullable (of Date)) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "EndDate", datEndDate, "ID", ";", "Nullable (of Date)")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.EndDate based on Project_LifeCycle.ID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function EndDateByID(ByVal strID As String) As Nullable (of Date)
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "ID", strID, "EndDate", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return IIf((IsDate(mv) = True), CDate(mv), Nothing)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.ID based on Project_LifeCycle.Milestones
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function IDByMilestones(ByVal strMilestones As String) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "Milestones", strMilestones, "ID", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.Milestones based on Project_LifeCycle.ID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function MilestonesByID(ByVal strID As String) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "ID", strID, "Milestones", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.ProjectID based on Project_LifeCycle.ProjectID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function ProjectIDByProjectID(ByVal intProjectID As Integer) As Integer
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "ProjectID", intProjectID, "ProjectID", ";", "Integer")
    mv = clsDL.MvField(mv, 1, ";")
    Return Val(mv)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.ProjectID based on Project_LifeCycle.StageID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function ProjectIDByStageID(ByVal intStageID As Integer) As Integer
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StageID", intStageID, "ProjectID", ";", "Integer")
    mv = clsDL.MvField(mv, 1, ";")
    Return Val(mv)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StageID based on Project_LifeCycle.ProjectID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StageIDByProjectID(ByVal intProjectID As Integer) As Integer
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "ProjectID", intProjectID, "StageID", ";", "Integer")
    mv = clsDL.MvField(mv, 1, ";")
    Return Val(mv)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.ProjectID based on Project_LifeCycle.StageName
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function ProjectIDByStageName(ByVal strStageName As String) As Integer
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StageName", strStageName, "ProjectID", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return Val(mv)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StageName based on Project_LifeCycle.ProjectID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StageNameByProjectID(ByVal intProjectID As Integer) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "ProjectID", intProjectID, "StageName", ";", "Integer")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.ProjectID based on Project_LifeCycle.StartDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function ProjectIDByStartDate(ByVal datStartDate As Nullable (of Date)) As Integer
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StartDate", datStartDate, "ProjectID", ";", "Nullable (of Date)")
    mv = clsDL.MvField(mv, 1, ";")
    Return Val(mv)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StartDate based on Project_LifeCycle.ProjectID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StartDateByProjectID(ByVal intProjectID As Integer) As Nullable (of Date)
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "ProjectID", intProjectID, "StartDate", ";", "Integer")
    mv = clsDL.MvField(mv, 1, ";")
    Return IIf((IsDate(mv) = True), CDate(mv), Nothing)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.ProjectID based on Project_LifeCycle.EndDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function ProjectIDByEndDate(ByVal datEndDate As Nullable (of Date)) As Integer
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "EndDate", datEndDate, "ProjectID", ";", "Nullable (of Date)")
    mv = clsDL.MvField(mv, 1, ";")
    Return Val(mv)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.EndDate based on Project_LifeCycle.ProjectID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function EndDateByProjectID(ByVal intProjectID As Integer) As Nullable (of Date)
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "ProjectID", intProjectID, "EndDate", ";", "Integer")
    mv = clsDL.MvField(mv, 1, ";")
    Return IIf((IsDate(mv) = True), CDate(mv), Nothing)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.ProjectID based on Project_LifeCycle.Milestones
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function ProjectIDByMilestones(ByVal strMilestones As String) As Integer
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "Milestones", strMilestones, "ProjectID", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return Val(mv)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.Milestones based on Project_LifeCycle.ProjectID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function MilestonesByProjectID(ByVal intProjectID As Integer) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "ProjectID", intProjectID, "Milestones", ";", "Integer")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StageID based on Project_LifeCycle.StageID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StageIDByStageID(ByVal intStageID As Integer) As Integer
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StageID", intStageID, "StageID", ";", "Integer")
    mv = clsDL.MvField(mv, 1, ";")
    Return Val(mv)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StageID based on Project_LifeCycle.StageName
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StageIDByStageName(ByVal strStageName As String) As Integer
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StageName", strStageName, "StageID", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return Val(mv)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StageName based on Project_LifeCycle.StageID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StageNameByStageID(ByVal intStageID As Integer) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StageID", intStageID, "StageName", ";", "Integer")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StageID based on Project_LifeCycle.StartDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StageIDByStartDate(ByVal datStartDate As Nullable (of Date)) As Integer
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StartDate", datStartDate, "StageID", ";", "Nullable (of Date)")
    mv = clsDL.MvField(mv, 1, ";")
    Return Val(mv)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StartDate based on Project_LifeCycle.StageID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StartDateByStageID(ByVal intStageID As Integer) As Nullable (of Date)
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StageID", intStageID, "StartDate", ";", "Integer")
    mv = clsDL.MvField(mv, 1, ";")
    Return IIf((IsDate(mv) = True), CDate(mv), Nothing)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StageID based on Project_LifeCycle.EndDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StageIDByEndDate(ByVal datEndDate As Nullable (of Date)) As Integer
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "EndDate", datEndDate, "StageID", ";", "Nullable (of Date)")
    mv = clsDL.MvField(mv, 1, ";")
    Return Val(mv)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.EndDate based on Project_LifeCycle.StageID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function EndDateByStageID(ByVal intStageID As Integer) As Nullable (of Date)
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StageID", intStageID, "EndDate", ";", "Integer")
    mv = clsDL.MvField(mv, 1, ";")
    Return IIf((IsDate(mv) = True), CDate(mv), Nothing)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StageID based on Project_LifeCycle.Milestones
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StageIDByMilestones(ByVal strMilestones As String) As Integer
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "Milestones", strMilestones, "StageID", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return Val(mv)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.Milestones based on Project_LifeCycle.StageID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function MilestonesByStageID(ByVal intStageID As Integer) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StageID", intStageID, "Milestones", ";", "Integer")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StageName based on Project_LifeCycle.StageName
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StageNameByStageName(ByVal strStageName As String) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StageName", strStageName, "StageName", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StageName based on Project_LifeCycle.StartDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StageNameByStartDate(ByVal datStartDate As Nullable (of Date)) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StartDate", datStartDate, "StageName", ";", "Nullable (of Date)")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StartDate based on Project_LifeCycle.StageName
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StartDateByStageName(ByVal strStageName As String) As Nullable (of Date)
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StageName", strStageName, "StartDate", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return IIf((IsDate(mv) = True), CDate(mv), Nothing)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StageName based on Project_LifeCycle.EndDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StageNameByEndDate(ByVal datEndDate As Nullable (of Date)) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "EndDate", datEndDate, "StageName", ";", "Nullable (of Date)")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.EndDate based on Project_LifeCycle.StageName
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function EndDateByStageName(ByVal strStageName As String) As Nullable (of Date)
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StageName", strStageName, "EndDate", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return IIf((IsDate(mv) = True), CDate(mv), Nothing)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StageName based on Project_LifeCycle.Milestones
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StageNameByMilestones(ByVal strMilestones As String) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "Milestones", strMilestones, "StageName", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.Milestones based on Project_LifeCycle.StageName
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function MilestonesByStageName(ByVal strStageName As String) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StageName", strStageName, "Milestones", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StartDate based on Project_LifeCycle.StartDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StartDateByStartDate(ByVal datStartDate As Nullable (of Date)) As Nullable (of Date)
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StartDate", datStartDate, "StartDate", ";", "Nullable (of Date)")
    mv = clsDL.MvField(mv, 1, ";")
    Return IIf((IsDate(mv) = True), CDate(mv), Nothing)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StartDate based on Project_LifeCycle.EndDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StartDateByEndDate(ByVal datEndDate As Nullable (of Date)) As Nullable (of Date)
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "EndDate", datEndDate, "StartDate", ";", "Nullable (of Date)")
    mv = clsDL.MvField(mv, 1, ";")
    Return IIf((IsDate(mv) = True), CDate(mv), Nothing)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.EndDate based on Project_LifeCycle.StartDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function EndDateByStartDate(ByVal datStartDate As Nullable (of Date)) As Nullable (of Date)
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StartDate", datStartDate, "EndDate", ";", "Nullable (of Date)")
    mv = clsDL.MvField(mv, 1, ";")
    Return IIf((IsDate(mv) = True), CDate(mv), Nothing)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.StartDate based on Project_LifeCycle.Milestones
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function StartDateByMilestones(ByVal strMilestones As String) As Nullable (of Date)
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "Milestones", strMilestones, "StartDate", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return IIf((IsDate(mv) = True), CDate(mv), Nothing)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.Milestones based on Project_LifeCycle.StartDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function MilestonesByStartDate(ByVal datStartDate As Nullable (of Date)) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "StartDate", datStartDate, "Milestones", ";", "Nullable (of Date)")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.EndDate based on Project_LifeCycle.EndDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function EndDateByEndDate(ByVal datEndDate As Nullable (of Date)) As Nullable (of Date)
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "EndDate", datEndDate, "EndDate", ";", "Nullable (of Date)")
    mv = clsDL.MvField(mv, 1, ";")
    Return IIf((IsDate(mv) = True), CDate(mv), Nothing)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.EndDate based on Project_LifeCycle.Milestones
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function EndDateByMilestones(ByVal strMilestones As String) As Nullable (of Date)
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "Milestones", strMilestones, "EndDate", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return IIf((IsDate(mv) = True), CDate(mv), Nothing)
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.Milestones based on Project_LifeCycle.EndDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function MilestonesByEndDate(ByVal datEndDate As Nullable (of Date)) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "EndDate", datEndDate, "Milestones", ";", "Nullable (of Date)")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return a particular field based on another field. In this case return Project_LifeCycle.Milestones based on Project_LifeCycle.Milestones
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function MilestonesByMilestones(ByVal strMilestones As String) As String
    Dim mv As String = SQLCompact.RecordReadToMv("Project_LifeCycle", "Milestones", strMilestones, "Milestones", ";", "String")
    mv = clsDL.MvField(mv, 1, ";")
    Return mv
End Function


''' <summary>
''' Return the list of strings of a particular field. In this case Project_LifeCycle.ID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
    Public Shared Function IDList(Optional bAddNone As Boolean = False, Optional bIsDate As Boolean = False, Optional FldDelim As String = ";") As List(Of String)
        Dim strs As List(Of String) = SQLCompact.TableDistinctList("Project_LifeCycle", "ID", "{0}", bAddNone, bIsDate, FldDelim)
        Return strs
    End Function

''' <summary>
''' Return the list of strings of a particular field. In this case Project_LifeCycle.ProjectID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
    Public Shared Function ProjectIDList(Optional bAddNone As Boolean = False, Optional bIsDate As Boolean = False, Optional FldDelim As String = ";") As List(Of String)
        Dim strs As List(Of String) = SQLCompact.TableDistinctList("Project_LifeCycle", "ProjectID", "{0}", bAddNone, bIsDate, FldDelim)
        Return strs
    End Function

''' <summary>
''' Return the list of strings of a particular field. In this case Project_LifeCycle.StageID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
    Public Shared Function StageIDList(Optional bAddNone As Boolean = False, Optional bIsDate As Boolean = False, Optional FldDelim As String = ";") As List(Of String)
        Dim strs As List(Of String) = SQLCompact.TableDistinctList("Project_LifeCycle", "StageID", "{0}", bAddNone, bIsDate, FldDelim)
        Return strs
    End Function

''' <summary>
''' Return the list of strings of a particular field. In this case Project_LifeCycle.StageName
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
    Public Shared Function StageNameList(Optional bAddNone As Boolean = False, Optional bIsDate As Boolean = False, Optional FldDelim As String = ";") As List(Of String)
        Dim strs As List(Of String) = SQLCompact.TableDistinctList("Project_LifeCycle", "StageName", "{0}", bAddNone, bIsDate, FldDelim)
        Return strs
    End Function

''' <summary>
''' Return the list of strings of a particular field. In this case Project_LifeCycle.StartDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
    Public Shared Function StartDateList(Optional bAddNone As Boolean = False, Optional bIsDate As Boolean = False, Optional FldDelim As String = ";") As List(Of String)
        Dim strs As List(Of String) = SQLCompact.TableDistinctList("Project_LifeCycle", "StartDate", "{0}", bAddNone, bIsDate, FldDelim)
        Return strs
    End Function

''' <summary>
''' Return the list of strings of a particular field. In this case Project_LifeCycle.EndDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
    Public Shared Function EndDateList(Optional bAddNone As Boolean = False, Optional bIsDate As Boolean = False, Optional FldDelim As String = ";") As List(Of String)
        Dim strs As List(Of String) = SQLCompact.TableDistinctList("Project_LifeCycle", "EndDate", "{0}", bAddNone, bIsDate, FldDelim)
        Return strs
    End Function

''' <summary>
''' Return the list of strings of a particular field. In this case Project_LifeCycle.Milestones
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
    Public Shared Function MilestonesList(Optional bAddNone As Boolean = False, Optional bIsDate As Boolean = False, Optional FldDelim As String = ";") As List(Of String)
        Dim strs As List(Of String) = SQLCompact.TableDistinctList("Project_LifeCycle", "Milestones", "{0}", bAddNone, bIsDate, FldDelim)
        Return strs
    End Function

''' <summary>
''' Return the total number of records in the table Project_LifeCycle
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function Count() As Integer
Dim nRecords As Integer = 0
Dim dt As DataTable = SQLCompact.OpenDataTable("select Count(ID) as Records from [Project_LifeCycle]")
For Each dr As DataRow In dt.Rows
nRecords = Val(dr("Records").ToString)
Next
Return nRecords
End Function


''' <summary>
''' Return the total number of records with a particular value in a field. In this case Project_LifeCycle.ID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function CountByID(ByVal strID As String) As Integer
Dim sQry As String = "Select Count(ID) As Records from [Project_LifeCycle] where [ID] = '" & strID & "'"
Dim dt As DataTable = SQLCompact.OpenDataTable(sQRY)
Dim nRecords as integer = 0
For Each dr As DataRow In dt.Rows
nRecords = Val(dr("Records").ToString)
Next
Return nRecords
End Function

''' <summary>
''' Return the total number of records with a particular value in a field. In this case Project_LifeCycle.ProjectID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function CountByProjectID(ByVal intProjectID As Integer) As Integer
Dim sQry As String = "Select Count(ID) As Records from [Project_LifeCycle] where [ProjectID] = " & intProjectID
Dim dt As DataTable = SQLCompact.OpenDataTable(sQRY)
Dim nRecords as integer = 0
For Each dr As DataRow In dt.Rows
nRecords = Val(dr("Records").ToString)
Next
Return nRecords
End Function

''' <summary>
''' Return the total number of records with a particular value in a field. In this case Project_LifeCycle.StageID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function CountByStageID(ByVal intStageID As Integer) As Integer
Dim sQry As String = "Select Count(ID) As Records from [Project_LifeCycle] where [StageID] = " & intStageID
Dim dt As DataTable = SQLCompact.OpenDataTable(sQRY)
Dim nRecords as integer = 0
For Each dr As DataRow In dt.Rows
nRecords = Val(dr("Records").ToString)
Next
Return nRecords
End Function

''' <summary>
''' Return the total number of records with a particular value in a field. In this case Project_LifeCycle.StageName
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function CountByStageName(ByVal strStageName As String) As Integer
Dim sQry As String = "Select Count(ID) As Records from [Project_LifeCycle] where [StageName] = '" & strStageName & "'"
Dim dt As DataTable = SQLCompact.OpenDataTable(sQRY)
Dim nRecords as integer = 0
For Each dr As DataRow In dt.Rows
nRecords = Val(dr("Records").ToString)
Next
Return nRecords
End Function

''' <summary>
''' Return the total number of records with a particular value in a field. In this case Project_LifeCycle.StartDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function CountByStartDate(ByVal datStartDate As Nullable (of Date)) As Integer
Dim sQry As String = "Select Count(ID) As Records from [Project_LifeCycle] where [StartDate] = " & datStartDate
Dim dt As DataTable = SQLCompact.OpenDataTable(sQRY)
Dim nRecords as integer = 0
For Each dr As DataRow In dt.Rows
nRecords = Val(dr("Records").ToString)
Next
Return nRecords
End Function

''' <summary>
''' Return the total number of records with a particular value in a field. In this case Project_LifeCycle.EndDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function CountByEndDate(ByVal datEndDate As Nullable (of Date)) As Integer
Dim sQry As String = "Select Count(ID) As Records from [Project_LifeCycle] where [EndDate] = " & datEndDate
Dim dt As DataTable = SQLCompact.OpenDataTable(sQRY)
Dim nRecords as integer = 0
For Each dr As DataRow In dt.Rows
nRecords = Val(dr("Records").ToString)
Next
Return nRecords
End Function

''' <summary>
''' Return the total number of records with a particular value in a field. In this case Project_LifeCycle.Milestones
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function CountByMilestones(ByVal strMilestones As String) As Integer
Dim sQry As String = "Select Count(ID) As Records from [Project_LifeCycle] where [Milestones] = '" & strMilestones & "'"
Dim dt As DataTable = SQLCompact.OpenDataTable(sQRY)
Dim nRecords as integer = 0
For Each dr As DataRow In dt.Rows
nRecords = Val(dr("Records").ToString)
Next
Return nRecords
End Function

''' <summary>
''' Return True or False if a particular Project_LifeCycle record exists.
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function Exists(ByVal intID as Integer) As Boolean
Dim flag As Boolean = SQLCompact.RecordExists("Project_LifeCycle", "ID", intID, "Long")
Return flag
End Function


''' <summary>
''' Return True or False if a particular Project_LifeCycle record exists based on ID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function ExistsByID(ByVal strID As String) As Boolean
Dim flag As Boolean = SQLCompact.RecordExists("Project_LifeCycle", "ID", strID, "String")
Return flag
End Function

''' <summary>
''' Return True or False if a particular Project_LifeCycle record exists based on ProjectID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function ExistsByProjectID(ByVal intProjectID As Integer) As Boolean
Dim flag As Boolean = SQLCompact.RecordExists("Project_LifeCycle", "ProjectID", intProjectID, "Integer")
Return flag
End Function

''' <summary>
''' Return True or False if a particular Project_LifeCycle record exists based on StageID
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function ExistsByStageID(ByVal intStageID As Integer) As Boolean
Dim flag As Boolean = SQLCompact.RecordExists("Project_LifeCycle", "StageID", intStageID, "Integer")
Return flag
End Function

''' <summary>
''' Return True or False if a particular Project_LifeCycle record exists based on StageName
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function ExistsByStageName(ByVal strStageName As String) As Boolean
Dim flag As Boolean = SQLCompact.RecordExists("Project_LifeCycle", "StageName", strStageName, "String")
Return flag
End Function

''' <summary>
''' Return True or False if a particular Project_LifeCycle record exists based on StartDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function ExistsByStartDate(ByVal datStartDate As Nullable (of Date)) As Boolean
Dim flag As Boolean = SQLCompact.RecordExists("Project_LifeCycle", "StartDate", datStartDate, "Nullable (of Date)")
Return flag
End Function

''' <summary>
''' Return True or False if a particular Project_LifeCycle record exists based on EndDate
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function ExistsByEndDate(ByVal datEndDate As Nullable (of Date)) As Boolean
Dim flag As Boolean = SQLCompact.RecordExists("Project_LifeCycle", "EndDate", datEndDate, "Nullable (of Date)")
Return flag
End Function

''' <summary>
''' Return True or False if a particular Project_LifeCycle record exists based on Milestones
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Function ExistsByMilestones(ByVal strMilestones As String) As Boolean
Dim flag As Boolean = SQLCompact.RecordExists("Project_LifeCycle", "Milestones", strMilestones, "String")
Return flag
End Function

''' <summary>
''' Read Method to read Project_LifeCycle record from the database using a primarykey.
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Sub Read(ByVal sID As String)
Try
Clear()
Dim nRead As New DataSet()
nRead = SQLCompact.RecordSeek("Project_LifeCycle", "ID", sID, "*", "Integer")
Dim xCount As Boolean = nRead.Tables(0).Rows.Count - 1 <> -1
If xCount Then
Dim xRow As DataRow = nRead.Tables(0).Rows(0)
ID = xRow("ID").ToString
ProjectID = Val(xRow("ProjectID").ToString)
StageID = Val(xRow("StageID").ToString)
StageName = xRow("StageName").ToString
StartDate = IIf((IsDate(xRow("StartDate").ToString) = True), CDate(xRow("StartDate").ToString), Nothing)
EndDate = IIf((IsDate(xRow("EndDate").ToString) = True), CDate(xRow("EndDate").ToString), Nothing)
Milestones = xRow("Milestones").ToString
Me.IsNew = False
nRead.Dispose()
End If
Catch exc as Exception
Throw new Exception(exc.Message)
End Try
End Sub

''' <summary>
''' Save a Project_LifeCycle record to the database using a primary key. This uses a property get and FieldsToUpdate, DateFields to update the database.
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Sub Save()
Try
Dim strTable As String = "Project_LifeCycle"
Dim strPriKey As String = "ID"
Dim CommText As String = ""
Dim xCommand As New SqlCeCommand
If ID = -1 Then
ID = SQLCompact.TableMaxValue(strTable, strPriKey, "") + 1
IsNew = True
Else
IsNew = False
End If
If FieldsToUpdate = "*" Then
FieldsToUpdate = SQLCompact.Table_FieldNames(strTable, False, ",")
End If
FieldsToUpdate = clsDL.MvRemoveDuplicates(Me.FieldsToUpdate, ",")
Dim strParameters As String = clsDL.MvPrefixBy(FieldsToUpdate, "@", ",")
If IsNew Then
CommText = clsDL.BuildInsertCommand(strTable, FieldsToUpdate, ",")
Else
CommText = clsDL.BuildUpdateCommand(strTable, FieldsToUpdate, strPriKey, ",")
End If
xCommand = SQLCompact.OpenCommand(CommText)
Dim spFields() As String = Split(FieldsToUpdate, ",")
With xCommand
.Parameters.Clear()
For each strField As String In spFields
Dim datePos As Integer = clsDL.MvSearch(DateFields, strField, ",")
If datePos > 0 Then
Dim strValue as string = clsDL.PropertyGet(Me, strField).ToString
.Parameters.AddWithValue("@" & strField, IIf((IsDate(strValue) = True), CDate(strValue), DBNull.Value))
Else
.Parameters.AddWithValue("@" & strField, clsDL.PropertyGet(Me, strField))
End If
Next
.ExecuteNonQuery()
End With
SQLCompact.Connection.Close()
xCommand.Dispose()
Catch exc as Exception
Throw new Exception(exc.Message)
End Try
End Sub

''' <summary>
''' This method builds up an editable grid based on selected records. The grid has Save, Clone and Delete buttons
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Sub ShowProject_LifeCycle(ByRef grdViews As FineUI.Grid, ByVal strFilter As String)
clsFineUI.Grid.Clear(grdViews, "", "")
clsFineUI.Grid.TableName = "Project_LifeCycle"
clsFineUI.Grid.DataKeyNames = "ID"
clsFineUI.Grid.PageSize = 50
clsFineUI.Grid.AllowPaging = True
clsFineUI.Grid.AllowSorting = True
clsFineUI.Grid.LoadMask = False
clsFineUI.Grid.Title = "Project_LifeCycle"
clsFineUI.Grid.ShowBorder = False
clsFineUI.Grid.ShowHeader = False
clsFineUI.Grid.EnableRowNumber = False
clsFineUI.Grid.AutoHeight = True
clsFineUI.Grid.AutoPostBack = False
clsFineUI.Grid.EnableCheckBoxSelect = True
clsFineUI.Grid.AutoWidth = True
clsFineUI.Grid.EnableAlternateRowColor = True
clsFineUI.Grid.EnableCollapse = False
clsFineUI.Grid.EnableMouseOverColor = True
clsFineUI.Grid.EnableMultiSelect = True
clsFineUI.Grid.EnableViewState = True
clsFineUI.Grid.EnableAjax = True
clsFineUI.Grid.ColumnLines = True
clsFineUI.Grid.ToolTipField = "StageName"
clsFineUI.Grid.IsDatabasePaging = False
clsFineUI.Grid.ShowGridHeader = True
clsFineUI.Grid.EnableHeaderMenu = True
clsFineUI.Grid.EnableColumnHide = True
clsFineUI.Grid.AddTextBox("ID", "ID", "{0}", "", "100", FineUi.TextAlign.Left, False, False, True)
clsFineUI.Grid.AddTextBox("StageName", "Stage Name", "{0}", "", "100", FineUi.TextAlign.Left, False, False, True)
clsFineUI.Grid.AddTextBox("StartDate", "Start Date", "{0:dd/MM/yyyy}", "", "100", FineUi.TextAlign.Left, False, False, True)
clsFineUI.Grid.AddTextBox("EndDate", "End Date", "{0:dd/MM/yyyy}", "", "100", FineUi.TextAlign.Left, False, False, True)
clsFineUI.Grid.AddTextBox("Milestones", "Milestones", "{0}", "", "100", FineUi.TextAlign.Left, False, True, True)
clsFineUI.Grid.AddSave()
clsFineUI.Grid.AddClone()
clsFineUI.Grid.AddDelete()
If Len(strFilter) > 0 Then clsFineUI.Grid.Filter = strFilter
clsFineUI.Grid.OrderBy = "ID"
clsFineUI.Grid.BuildSelectCommand()
clsFineUI.Grid.UseSQLCompact = True
clsFineUI.Grid.Update(Nothing)
End Sub

''' <summary>
''' Builds a readonly grid based on selected records, this grid has Edit, Clone, Delete, Like and Comment buttons.
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Sub ShowGrid(ByRef grdViews As FineUI.Grid, ByVal strFilter As String)
clsFineUI.Grid.Clear(grdViews, "", "")
clsFineUI.Grid.TableName = "Project_LifeCycle"
clsFineUI.Grid.DataKeyNames = "ID"
clsFineUI.Grid.PageSize = 50
clsFineUI.Grid.AllowPaging = True
clsFineUI.Grid.AllowSorting = True
clsFineUI.Grid.LoadMask = False
clsFineUI.Grid.Title = "Project_LifeCycle"
clsFineUI.Grid.ShowBorder = False
clsFineUI.Grid.ShowHeader = False
clsFineUI.Grid.EnableRowNumber = False
clsFineUI.Grid.AutoHeight = True
clsFineUI.Grid.AutoPostBack = False
clsFineUI.Grid.EnableCheckBoxSelect = True
clsFineUI.Grid.AutoWidth = True
clsFineUI.Grid.EnableAlternateRowColor = True
clsFineUI.Grid.EnableCollapse = False
clsFineUI.Grid.EnableMouseOverColor = True
clsFineUI.Grid.EnableMultiSelect = True
clsFineUI.Grid.EnableViewState = True
clsFineUI.Grid.EnableAjax = True
clsFineUI.Grid.ColumnLines = True
clsFineUI.Grid.ToolTipField = "StageName"
clsFineUI.Grid.IsDatabasePaging = False
clsFineUI.Grid.ShowGridHeader = True
clsFineUI.Grid.EnableHeaderMenu = True
clsFineUI.Grid.EnableColumnHide = True
clsFineUI.Grid.AddColumn("ID", "ID", "{0}", "", "", False, "100", FineUi.TextAlign.Left, False)
clsFineUI.Grid.AddColumn("StageName", "Stage Name", "{0}", "", "", False, "100", FineUi.TextAlign.Left, False)
clsFineUI.Grid.AddColumn("StartDate", "Start Date", "{0:dd/MM/yyyy}", "", "", False, "100", FineUi.TextAlign.Left, False)
clsFineUI.Grid.AddColumn("EndDate", "End Date", "{0:dd/MM/yyyy}", "", "", False, "100", FineUi.TextAlign.Left, False)
clsFineUI.Grid.AddColumn("Milestones", "Milestones", "{0}", "", "", False, "100", FineUi.TextAlign.Left, False)
clsFineUI.Grid.AddEditCloneDelete()
clsFineUI.Grid.AddLikeComment()
If Len(strFilter) > 0 Then clsFineUI.Grid.Filter = strFilter
clsFineUI.Grid.OrderBy = "ID"
clsFineUI.Grid.BuildSelectCommand()
clsFineUI.Grid.UseSQLCompact = True
clsFineUI.Grid.Update(Nothing)
End Sub

''' <summary>
''' Import Project_LifeCycle records from a csv file.
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Shared Sub ImportFile(ByVal SourceFile As String, ByVal FileData As String)
Try
Dim spLines As String() = Strings.Split(FileData, vbCr & vbLf)
For each strLine As String In spLines
strLine = strLine.Trim
If Len(strLine) > 0 Then
Dim spLine As String() = Strings.Split(strLine, ",")
Dim clsNewProject_LifeCycle As New clsProject_LifeCycle
With clsNewProject_LifeCycle
.IsNew = True
.ID = -1
.Save
End With
End If
Next
Catch exc as exception
Throw new Exception(exc.message)
End Try
End Sub

''' <summary>
''' Define a blank Project_LifeCycle record and save it in a database. This method is useful for a grid like interface.
''' </summary>
''' <remarks>This code is automatically generated by SystemBuilder.Show.</remarks>
Public Sub Blank()
Dim clsNewProject_LifeCycle As New clsProject_LifeCycle
clsNewProject_LifeCycle.Clear()
clsNewProject_LifeCycle.IsNew = True
clsNewProject_LifeCycle.ID = -1
clsNewProject_LifeCycle.Save
clsNewProject_LifeCycle = Nothing
End Sub
End Class

